package net.njcp.mybatis.frame.dao;

import net.njcp.mybatis.frame.builder.BaseMapperBuilder;
import net.njcp.mybatis.frame.builder.CustomSqlBuilder;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @ClassName BaseMapper
 * @Description: 基础查询Mapper
 * @Author 柳拓
 * @Date 2019/8/12
 * @Version V1.0
 **/
@Mapper
public interface BaseMapper {

    @UpdateProvider(type = BaseMapperBuilder.class, method = "buildUpdateSql")
    void executeUpdateSql(Object object);

    @InsertProvider(type = BaseMapperBuilder.class, method = "buildInsertSql")
    void executeInsertSql(Object object);

    //按照mybatis方式动态生成sql，比直接执行sql安全
    @SelectProvider(type = BaseMapperBuilder.class, method = "buildSql")
    List<Map<String, Object>> executeBuildSql(CustomSqlBuilder sqlBuilder);

    //尽量不使用-》sql注入风险
    @SelectProvider(type = BaseMapperBuilder.class, method = "executeSql")
    List<Map<String, Object>> executeSql(String sql);


}

